﻿using Springwater.DataAccessLayer.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Springwater.Business.ViewModels
{
    public class SearchPanelModel
    {
        public List<SelectListItem> TajegysegDLL { get; set; }
        public List<SelectListItem> VizgyujtoDLL { get; set; }

        public SearchPanelModel(UnitOfWork unitOfWork)
        {
            this.TajegysegDLL = unitOfWork.BorvizRepository.Get().Select(b => b.Tajegyseg).Distinct().OrderBy(t => t).Select(t => new SelectListItem() { Text = t, Value = t, Selected = false }).ToList();
            this.VizgyujtoDLL = unitOfWork.VizgyujtoRepository.Get().OrderBy(v => v.Nev).Select(v => new SelectListItem() { Text = v.Nev, Value = v.Id.ToString(), Selected = false }).ToList();

            this.TajegysegDLL.Insert(0, new SelectListItem() { Text = string.Empty, Value = null, Selected = false });
            this.VizgyujtoDLL.Insert(0, new SelectListItem() { Text = string.Empty, Value = null, Selected = false });
        }
    }
}
